package io.renren.modules.bmx.service.impl;

import io.renren.modules.bmx.vo.CartypeVo;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.bmx.dao.CartypeDao;
import io.renren.modules.bmx.entity.CartypeEntity;
import io.renren.modules.bmx.service.CartypeService;


@Service("cartypeService")
public class CartypeServiceImpl extends ServiceImpl<CartypeDao, CartypeEntity> implements CartypeService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CartypeEntity> page = this.page(
                new Query<CartypeEntity>().getPage(params),
                new QueryWrapper<CartypeEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 根据userId 查找改用户对应的数据权限：包括车型、科目、题型、套题
     *
     * @param userId
     * @return
     */
    @Override
    public List<CartypeVo> findUserAllLevels(Long userId) {
        return baseMapper.selectUserAllLevels(userId);
    }


}
